from celery import Celery
from .config import Config


def make_celery():
    celery = Celery(__name__)
    
   
    # 使用新版配置格式
    celery.conf.update(
        broker_url=Config.CELERY_BROKER_URL,
        result_backend=Config.CELERY_RESULT_BACKEND,
        task_serializer='json',
        result_serializer='json',
        accept_content=['json'],
        timezone='Asia/Shanghai'
    )
    return celery

celery = make_celery()
